<?php
define('web_s', 'johnsongod');
$common['cururl'] = 'index';
$common['title'] = '首页';
require 'includes/init.php';

//推荐
$recommendlist = $db->getAll("select * from m_goods where is_recommend = '1' and is_enable = '1' order by add_time desc, goods_id desc");
foreach($recommendlist as $k => $v){
	$recommendlist[$k]['thumb'] = $db->getOne("select thumb from m_goods_pic where goods_id = {$v['goods_id']} order by id desc limit 1");
}
$smarty->assign('recommendlist', $recommendlist);

//新品
$newlist = $db->getAll("select * from m_goods where is_new = '1' and is_enable = '1' order by add_time desc, goods_id desc");
foreach($newlist as $k => $v){
	$newlist[$k]['thumb'] = $db->getOne("select thumb from m_goods_pic where goods_id = {$v['goods_id']} order by id desc limit 1");
}
$smarty->assign('newlist', $newlist);

//供求
$buyselllist = $db->getAll("select * from m_goods where is_enable = '1' order by add_time desc, goods_id desc limit 6");
$smarty->assign('buyselllist', $buyselllist);

//浏览排行
$viewpointlist = $db->getAll("select * from m_goods where is_enable = '1' order by viewpoint desc limit 10");
$smarty->assign('viewpointlist', $viewpointlist);

$smarty->display("index.htm");